<template>
	<view class="full-page" v-if="totalPage">
		
	</view>
	<view class="content" v-else>
		<view class="fixed-top">
			<view class="topli">
				<view class="serbox" >
					<image :src="'/images/search.png' | formatImgUrl" class="serpic" mode=""></image>
					<input type="text" class="serput" v-model="like" @input="onSearch" placeholder="搜订单">
				</view>
			</view>
			<scroll-view scroll-x="true" class="status-box">
				<text :class="status == it.value ? 'current' : ''" v-for="(it,ix) in statusList" :key="ix"
					@tap="selStatus(it)">{{it.name}}</text>
			</scroll-view>
		</view>
		
		
		
		<!-- <view class="topli" v-if="$db.get('userInfo').is_writer">
			<view v-for="item in navList" class="toptxt" :class="{'active': item.id == navIndex}" @click="navTap(item)">
				{{item.name}}
				<view class="line"></view>
			</view>
		</view> -->
		<view class="orbox">
			<!-- <view class="ortop">
				<view class="ortitle">
					订单列表
				</view>
				<view class="oryou" @click="show = true">
					<image :src="'/images/shai.png' | formatImgUrl" class="orpic" mode=""></image>
					<view class="saitxt">
						筛选
					</view>
				</view>
			</view> -->

			

			<view class="empytView" v-if="!rowList.length">
				<image :src="'/images/kong.png' | formatImgUrl" mode="widthFix" />
				<!-- <view>- 空列表 -</view> -->
			</view>

			<view class="orli" v-for="item in rowList" v-if="item.order_type == 1" @tap="lookOrder(item)">
				<!-- <view v-if="navIndex == 1"
				 @click="item.status == 4 && !item.is_eval?$go('/pages/user/evaluate?id='+item.id):$go('/pages/user/orderdetail?id='+item.id)"> -->

				<view v-if="navIndex == 1">

					<view class="shbox">
						<image :src="item.writer.pic | formatImgUrl" class="head" mode=""></image>
						<view class="shou">
							{{item.writer.username}}
						</view>
						<view class="tuitxt">
							<text v-if="item.ref_status_fb == 2 || (item.ref_num > 0 && status == 5)" class="status1">已退款</text>
							<text v-else-if="item.res_status == 1" class="status1">申诉中</text>
							<text v-else-if="item.status == 4 && item.is_eval">已评价</text>
							<text v-else-if="item.status == 4 && item.is_eval == 0">待评价</text>
							<text v-else-if="item.ref_status==1 && item.is_tk == 0" class="status1">待处理</text>
							
							<text v-else-if="item.status_label=='已接单'" class="status3">进行中</text>
							<text v-else-if="item.status_label == '已支付'" class="status3">待接单</text>

							<text v-else class="status3">{{item.status_label}}</text>
						</view>
					</view>

					<view class="jjbox">
						<image :src="'/images/jj.png' | formatImgUrl" class="kpic" mode=""></image>
						<view class="jtxt">
							{{item.c_title}}
						</view>
					</view>
					<view class="dbox">
						<view class="dtxt display-flex">
							{{item.c_desc}}<text>| 共{{item.num}}单</text><text>| 共{{item.num || ''}}{{item.c_word_count || ''}}</text>
						</view>
						<view class="gong">
							共计支付
							<text class="active">{{item.cv_price?(Number(item.price - item.cv_price).toFixed(0)):Number(item.price).toFixed(0)}}</text>
							币
						</view>
					</view>
					
					<!-- 用户 -->
					<block v-if="item.writer_uid != $db.get('userInfo').membe_id">
						<block v-if="item.ref_status_fb == 2">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">全部退款</text>
									<text class="status-desc">退还 {{Number(item.price).toFixed(0)}}粮币 至账户余额</text>
								</view>
							</view>
						</block>
						<block v-else-if="item.ref_status_fb == 1">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">部分退款</text>
									<text class="status-desc">退还 {{Number(item.ref_money).toFixed(0)}}粮币 至账户余额</text>
								</view>
								<view class="order-tip-right"  style="font-weight: bold;color: #3D3D3D;" @tap.stop="$go('/showcase/showcase/tuiList?oid='+item.id)">
									查看关联订单
								</view>
							</view>
						</block>
						<block v-else-if="item.ref_status==1 && item.is_tk == 0">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">用户退款</text>
									<text class="status-desc">您已发起退款申请，等待写手处理</text>
								</view>
							</view>
						</block>
						<block v-else-if="item.res_status==1">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单申诉</text>
									<text class="status-desc">订单正在申诉中，耐心等待申诉结果吧</text>
								</view>
						
							</view>
						</block>
						<block v-else-if="item.status==1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">提前沟通</text>
									<text class="status-desc">详细的描述会增加写手接单的概率</text>
								</view>
								<view class="order-tip-right" @tap="toImRoom(item)" style="font-weight: bold;">
									进行沟通
								</view>
							</view>
						</block>
						
						
						<block v-else-if="item.status==2">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">正在制作</text>
									<text class="status-desc">写手奋笔疾书中，请耐心等待</text>
								</view>
								<view class="order-tip-right" v-if="item.jg_time">
									<wly-countdown :day="getDateStr(item.jg_time,0)" :hour="getDateStr(item.jg_time,1)" :minute="getDateStr(item.jg_time,2)"
										:second="getDateStr(item.jg_time,3)" showType="slot">
										<template v-slot="{day, hour, minute, second}">
											<view class="display-flex" v-if="day||hour||minute||second">
												<view class="time_model" v-if="day">
													<view>
														{{day}}
													</view>
													<view>
														天
													</view>
												</view>		
												<view class="time_model">
													<view>
														{{hour}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{minute}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{second}}
													</view>
												</view>
											</view>
										</template>
									</wly-countdown>
								</view>
							</view>
						</block>
						
						
						
						
						<block v-else-if="item.status==3">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">写手交稿</text>
									<text class="status-desc">请在倒计时完成前完成查看</text>
								</view>
								<view class="order-tip-right" v-if="item.dg_time">
									<wly-countdown :day="getDateStr(item.dg_time,0)" :hour="getDateStr(item.dg_time,1)" :minute="getDateStr(item.dg_time,2)"
										:second="getDateStr(item.dg_time,3)" showType="slot">
										<template v-slot="{day, hour, minute, second}">
											<view class="display-flex" v-if="day||hour||minute||second">
												<view class="time_model" v-if="day">
													<view>
														{{day}}
													</view>
													<view>
														天
													</view>
												</view>
												<view class="time_model">
													<view>
														{{hour}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{minute}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{second}}
													</view>
												</view>
											</view>
										</template>
									</wly-countdown>
								</view>
							</view>
						</block>
						
						<block v-else-if="item.writer_uid != $db.get('userInfo').membe_id && item.is_eval == 0 && item.status == 4">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">发布评价</text>
									<text class="status-desc">写手是否准时交稿？是否满意呢</text>
								</view>
								<view class="order-tip-right" @tap.stop="$go('/pages/user/evaluate?id='+item.id)" style="font-weight: bold;">
									立即评价
								</view>
							</view>
						</block>
						<block v-else-if="item.status == 4 && item.is_eval == 1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单完成</text>
									<text class="status-desc" @tap="$go('/pages/user/orderdetail?id='+item.id)">点击查看详情可查看完整订单信息</text>
								</view>
							</view>
						</block>
					</block>
					
					<!-- 写手 -->
					<block v-if="item.writer_uid == $db.get('userInfo').membe_id">
						<block v-if="item.ref_status_fb == 2">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">全部退款</text>
									<text class="status-desc">退还 {{Number(item.price).toFixed(0)}}粮币 至用户账户</text>
								</view>
							</view>
						</block>
						<block v-else-if="item.ref_status_fb == 1">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">部分退款</text>
									<text class="status-desc">退还 {{Number(item.ref_money).toFixed(0)}}粮币 至用户账户</text>
								</view>
								<view class="order-tip-right"  style="font-weight: bold;color: #3D3D3D;" @tap.stop="$go('/showcase/showcase/tuiList?oid='+item.id)">
									查看关联订单
								</view>
							</view>
						</block>
						<block v-else-if="item.ref_status==1 && item.is_tk == 0">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">用户退款</text>
									<text class="status-desc">用户发起退款申请，请尽快处理</text>
								</view>
							</view>
						</block>
						<block v-else-if="item.res_status==1">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单申诉</text>
									<text class="status-desc">订单正在申诉中，耐心等待申诉结果吧</text>
								</view>
						
							</view>
						</block>
						<block v-else-if="item.status==1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">提前沟通</text>
									<text class="status-desc">请积极与用户沟通制作需求后接单</text>
								</view>
								<view class="order-tip-right" @tap="toImRoom(item)" style="font-weight: bold;">
									进行沟通
								</view>
							</view>
						</block>
						
						
						<block v-else-if="item.status==2">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">正在制作</text>
									<text class="status-desc">请在约定时间内完成稿件上传</text>
								</view>
								<view class="order-tip-right" v-if="item.jg_time">
									<wly-countdown :day="getDateStr(item.jg_time,0)" :hour="getDateStr(item.jg_time,1)" :minute="getDateStr(item.jg_time,2)"
										:second="getDateStr(item.jg_time,3)" showType="slot">
										<template v-slot="{day, hour, minute, second}">
											<view class="display-flex" v-if="day||hour||minute||second">
												<view class="time_model" v-if="day">
													<view>
														{{day}}
													</view>
													<view>
														天
													</view>
												</view>		
												<view class="time_model">
													<view>
														{{hour}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{minute}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{second}}
													</view>
												</view>
											</view>
										</template>
									</wly-countdown>
								</view>
							</view>
						</block>
						
						
						
						<block v-else-if="item.status==3">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">写手交稿</text>
									<text class="status-desc">已通知用户在规定时间内完成查收</text>
								</view>
								<view class="order-tip-right" v-if="item.dg_time">
									<wly-countdown :day="getDateStr(item.dg_time,0)" :hour="getDateStr(item.dg_time,1)" :minute="getDateStr(item.dg_time,2)"
										:second="getDateStr(item.dg_time,3)" showType="slot">
										<template v-slot="{day, hour, minute, second}">
											<view class="display-flex" v-if="day||hour||minute||second">
												<view class="time_model" v-if="day">
													<view>
														{{day}}
													</view>
													<view>
														天
													</view>
												</view>
												<view class="time_model">
													<view>
														{{hour}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{minute}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{second}}
													</view>
												</view>
											</view>
										</template>
									</wly-countdown>
								</view>
							</view>
						</block>
						
						<block v-else-if="item.status == 4 && item.is_eval == 1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">发布评价</text>
									<text class="status-desc">已收到来自用户的订单评价</text>
								</view>
								<view class="order-tip-right"  @tap="$go('/showcase/showcase/evaluateinfo?id='+item.id)">
									立即查看
								</view>
							</view>
						</block>
						<block v-else-if="item.status == 4">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单完成</text>
									<text class="status-desc"  @tap="$go('/pages/user/orderdetail?id='+item.id)">点击查看详情可查看完整订单信息</text>
								</view>
							</view>
						</block>
					</block>

					<view class="buttons display-flex">
						<block v-if="item.ref_status_fb != 2 && item.is_acceptance == 0">
						<block v-if="item.status==1">
							<view class="button-item button1" @tap.stop="currentItem=item,showPop=true">
								{{item.writer_uid != $db.get('userInfo').membe_id ? '取消订单' : '拒绝接单'}} 
							</view>

						</block>

						<block v-if="(item.status==2 || item.status==3) && item.writer_uid != $db.get('userInfo').membe_id">
							<view class="button-item button1" @tap.stop="$go('/showcase/showcase/reback?oid='+item.id + '&amount=' + item.price + '&orderNum=' + (item.num-item.ref_num))" v-if="item.ref_status == 0">
								申请退款
							</view>
							<view class="button-item button1" @tap.stop="currentItem=item,show1=true">
								完成订单
							</view>
						</block>
						<block v-if="item.ref_status==1 && item.is_tk == 0 && item.writer_uid != $db.get('userInfo').membe_id">
							<view class="button-item button1" @tap.stop="currentItem=item,closeRefund()">
								取消退款
							</view>		
						</block>

						<block v-if="item.res_status==0 && item.status!=4 && item.status!=5 && item.status!=1">
							<view class="button-item button1" @tap.stop="$go('/pages/find/reportEva?id='+item.id+'&newtype=6')" v-if="item.res_status == 0">
								申诉订单
							</view>
						</block>
						</block>

						<!-- <block v-if="item.ref_status == 1">
							<view class="button-item button1">
								删除记录
							</view>
						</block> -->
						<view class="button-item button2" @tap.stop="$go('/pages/user/orderdetail?id='+item.id)">
							查看详情
						</view>
					</view>
				</view>

				<view v-else>

					<view class="shbox">
						<image :src="item.user.pic | formatImgUrl" class="head" mode=""></image>
						<view class="shou">
							{{item.user.username}}
						</view>
						<view class="taitxt">
							<text v-if="item.ref_status_fb == 2 || item.ref_num > 0" class="status1">已退款</text>
							<text v-else-if="item.res_status == 1" class="status1">申诉中</text>
							<text v-else-if="item.ref_status==1 && item.is_tk == 0" class="status1">待处理</text>
							<text v-else-if="item.status_label=='已接单'" class="status3">进行中</text>
							<text v-else-if="item.status_label == '已支付'" class="status3">待接单</text>

							<text v-else class="status3">{{item.status_label}}</text>
						</view>
					</view>
					<view class="jjbox">
						<image :src="'/images/jj.png' | formatImgUrl" class="kpic" mode=""></image>
						<view class="jtxt">
							{{item.c_title}}
						</view>
					</view>
					<view class="dbox">
						<view class="dtxt">
							{{item.c_desc}}<text>| 共{{item.num}}单</text>
						</view>
						<view class="gong">
							本单赚取
							<text class="lv">{{Number(item.price).toFixed(0)}}</text>
							币
						</view>
					</view>
					
					<!-- 用户 -->
					<block v-if="item.writer_uid != $db.get('userInfo').membe_id">
						<block v-if="item.ref_status==1 && item.is_tk == 0">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">用户退款</text>
									<text class="status-desc">您已发起退款申请，等待写手处理</text>
								</view>
						
							</view>
						</block>
						<block v-else-if="item.res_status==1">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单申诉</text>
									<text class="status-desc">订单正在申诉中，耐心等待申诉结果吧</text>
								</view>
						
							</view>
						</block>
						<block v-else-if="item.status==1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">提前沟通</text>
									<text class="status-desc">详细的描述会增加写手接单的概率</text>
								</view>
								<view class="order-tip-right" @tap="toImRoom(item)" style="font-weight: bold;">
									进行沟通
								</view>
							</view>
						</block>
						
						
						<block v-else-if="item.status==2">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">正在制作</text>
									<text class="status-desc">写手奋笔疾书中，请耐心等待</text>
								</view>
							</view>
						</block>
						
						
						
						<block v-else-if="item.status==3">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">写手交稿</text>
									<text class="status-desc">请在倒计时完成前完成查看</text>
								</view>
								<view class="order-tip-right" v-if="item.sy_time">
									<wly-countdown :day="getDateStr(item.sy_time,0)" :hour="getDateStr(item.sy_time,1)" :minute="getDateStr(item.sy_time,2)"
										:second="getDateStr(item.sy_time,3)" showType="slot">
										<template v-slot="{day, hour, minute, second}">
											<view class="display-flex" v-if="day||hour||minute||second">
												<view class="time_model" v-if="day">
													<view>
														{{day}}
													</view>
													<view>
														天
													</view>
												</view>
												<view class="time_model">
													<view>
														{{hour}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{minute}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{second}}
													</view>
												</view>
											</view>
										</template>
									</wly-countdown>
								</view>
							</view>
						</block>
						
						<block v-else-if="item.writer_uid != $db.get('userInfo').membe_id && item.is_eval == 0 && item.status == 4">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">发布评价</text>
									<text class="status-desc">写手是否准时交稿？是否满意呢</text>
								</view>
								<view class="order-tip-right" @tap.stop="$go('/pages/user/evaluate?id='+item.id)" style="font-weight: bold;">
									立即评价
								</view>
							</view>
						</block>
						<block v-else-if="item.status == 4 && item.is_eval == 1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单完成</text>
									<text class="status-desc" @tap="$go('/pages/user/orderdetail?id='+item.id)">点击查看详情可查看完整订单信息</text>
								</view>
							</view>
						</block>
					</block>
					
					<!-- 写手 -->
					<block v-if="item.writer_uid == $db.get('userInfo').membe_id">
						<block v-if="item.ref_status==1 && item.is_tk == 0">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">用户退款</text>
									<text class="status-desc">用户发起退款申请，请尽快处理</text>
								</view>
							</view>
						</block>
						<block v-else-if="item.res_status==1">
							<view class="order-tip order-tip2 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon01.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单申诉</text>
									<text class="status-desc">订单正在申诉中，耐心等待申诉结果吧</text>
								</view>
						
							</view>
						</block>
						<block v-else-if="item.status==1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">提前沟通</text>
									<text class="status-desc">请积极与用户沟通制作需求后接单</text>
								</view>
								<view class="order-tip-right" @tap="toImRoom(item)" style="font-weight: bold;">
									进行沟通
								</view>
							</view>
						</block>
						
						<block v-else-if="item.status==2">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">正在制作</text>
									<text class="status-desc">请在约定时间内完成稿件上传</text>
								</view>
							</view>
						</block>
						
						<block v-else-if="item.status==3">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">写手交稿</text>
									<text class="status-desc">已通知用户在规定时间内完成查收</text>
								</view>
								<view class="order-tip-right" v-if="item.sy_time">
									<wly-countdown :day="getDateStr(item.sy_time,0)" :hour="getDateStr(item.sy_time,1)" :minute="getDateStr(item.sy_time,2)"
										:second="getDateStr(item.sy_time,3)" showType="slot">
										<template v-slot="{day, hour, minute, second}">
											<view class="display-flex" v-if="day||hour||minute||second">
												<view class="time_model" v-if="day">
													<view>
														{{day}}
													</view>
													<view>
														天
													</view>
												</view>
												<view class="time_model">
													<view>
														{{hour}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{minute}}
													</view>
													<view>
														:
													</view>
												</view>
												<view class="time_model">
													<view>
														{{second}}
													</view>
												</view>
											</view>
										</template>
									</wly-countdown>
								</view>
							</view>
						</block>
						
						<!-- <block v-if="item.status == 4 && item.is_eval == 1">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">发布评价</text>
									<text class="status-desc">已收到来自用户的订单评价</text>
								</view>
								<view class="order-tip-right"  @tap="$go('/showcase/showcase/evaluateinfo?id='+item.id)">
									立即查看
								</view>
							</view>
						</block> -->
						<block v-else-if="item.status == 4">
							<view class="order-tip order-tip1 display-flex just-between">
								<view class="order-tip-left display-flex">
									<image :src="'/images/ordericon02.png' | formatImgUrl" mode="aspectFit"></image>
									<text class="status-txt">订单完成</text>
									<text class="status-desc"  @tap="$go('/pages/user/orderdetail?id='+item.id)">点击查看详情可查看完整订单信息</text>
								</view>
							</view>
						</block>
					</block>
					
					<view class="buttons display-flex">
						<block v-if="item.ref_status_fb != 2 && item.is_acceptance == 0">
							<block v-if="item.status==1">
								<view class="button-item button1" @tap.stop="currentItem=item,showPop=true">
									取消订单
								</view>
												
							</block>
												
							<block v-if="item.status==2 || item.status==3">
								<view class="button-item button1" @tap.stop="$go('/showcase/showcase/reback?oid='+item.id + '&amount=' + item.cv_price?(item.price - item.cv_price):item.price)" v-if="item.ref_status == 0">
									申请退款
								</view>
								<view class="button-item button1" @tap.stop="currentItem=item,show1=true">
									完成订单
								</view>
							</block>
							
							<block v-if="item.ref_status==1 && item.is_tk == 0">
								<view class="button-item button1" @tap.stop="currentItem=item,closeRefund()">
									取消退款
								</view>		
							</block>
												
							<block v-if="item.res_status==0 && item.status!=4 && item.status!=5 && item.status!=1">
								<view class="button-item button1" @tap.stop="$go('/pages/my/appeal?id='+item.id)" v-if="item.res_status == 0">
									申诉订单
								</view>
							</block>
						</block>
					
						<!-- <block v-if="item.ref_status == 1">
							<view class="button-item button1">
								删除记录
							</view>
						</block> -->
						<view class="button-item button2" @tap.stop="lookOrder(item)">
							查看详情
						</view>
					</view>
				</view>
			</view>


			<!-- <view class="nomore" v-if="rowList.length && list.current_page == list.last_page">
				没有更多了~
			</view> -->

		</view>

		<!-- 编辑弹框 -->
		<u-popup :show="show" @close="close" @open="open">
			<view class="mask">
				<view class="mabox">
					<view class="matop" v-for="item in statusList" @click="selStatus(item)">
						<view class="matxt">
							{{item.name}}
						</view>
						<image :src="'/images/rarr.png' | formatImgUrl" class="mapic" mode=""></image>
					</view>
				</view>

				<view class="qubox" @click="show = false">
					取消
				</view>
			</view>
		</u-popup>


		<!-- 取消订单 -->
		<u-popup mode="center" :show="showPop" @close="closeOrder">
			<view class="mask">
				<view class="matitle">
					<text v-if="currentItem.writer_uid == $db.get('userInfo').membe_id">确定拒绝订单吗？</text>
					<text v-else >是否确定取消该订单</text>
				</view>
				<view class="matxt">
					此操作不可更改
				</view>
				<view class="quque">
					<view class="quli" @click="showPop = false">
						取消
					</view>
					<view class="quli quactive" @click="goToindex(currentItem)">
						确定
					</view>
				</view>
			</view>
		</u-popup>
	
		<u-popup mode="center" :show="show1">
			<view class="mask">
				<view class="matitle">
					是否确定完成订单
				</view>
				<view class="matxt">
					完成后钱款将进入对方账户
				</view>
				<view class="quque">
					<view class="quli" @click="show1=false">
						取消
					</view>
					<view class="quli quactive" @click="goToroom">
						确定
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>
<script>
	import * as db from '@/common/db.js'
	import {
	  TUIConversationService,
	} from "@tencentcloud/chat-uikit-engine";
	export default {
		data() {
			return {
				// 编辑弹框
				show: false,
				// 点击切换
				navList: [{
					id: 1,
					name: '支出订单'
				}, {
					id: 2,
					name: '收入订单'
				}],
				navIndex: 1,
				statusList: [{
						name: '全部',
						value: ''
					}, {
						name: '待接单',
						value: 1
					}, {
						name: '进行中',
						value: 2
					}, {
						name: '定稿中',
						value: 3
					},{
						name: '待处理',
						value: 4
					},
					{
						name: '已退款',
						value: 5,
					},
					{
						name: '申诉中',
						value: 6,
					},{
						name:'已完成',
						value:7,
					},
					{
						name: '待评价',
						value: 8,
					},
					{
						name: '已取消',
						value: 9,
					}
					
				],
				page: 1,
				status: '',
				list: {},
				rowList: [],

				showPop: false,
				currentItem: {},
				show1: false,
				like: '',
				totalPage: true,
				isClick: true
			}
		},
		onLoad(e) {
			if (e.type && e.status) {
				this.navIndex = e.type
				this.status = e.status
				this.getList()
			}
		},
		onShow() {
			this.getList()
		},
		// 上拉加载
		onReachBottom() {
			if (this.list.current_page < this.list.last_page) {
				this.page++; // 页数加一，加载下一页数据
				this.getList();
			}
		},
		methods: {
			onSearch(){
				this.page = 1
				this.getList()
			},
			// 取消退款
			closeRefund(){
				this.$api.default.request('order/qxRefOrder', {
					oid: this.currentItem.id
				}, 'POST', false).then((res) => {
					if (res.code) {
						this.$common.successToShow(res.msg, () => {
							this.page = 1
							this.getList()
						})
					}
				})
			},
			// 完成订单
			goToroom() {
				this.$api.default.request('order/userConfirmOrder', {
					id: this.currentItem.id
				}, 'POST', false).then((res) => {
					if (res.code) {
						this.$common.successToShow(res.msg, () => {
							this.page = 1
							this.getList()
							
							this.show1=false
						})
					}
				})
			},
			getDateStr(mss, type) {
				var days = parseInt(mss / 86400);
				var hours = parseInt((mss - (days * 86400)) / 3600);
				var minutes = parseInt((mss - (days * 86400) - (hours * 3600)) / 60);
				var seconds = mss - (days * 86400) - (hours * 3600) - (minutes * 60)

				if (type == 0) {
					return days;
				}
				if (type == 1) {
					return hours;
				}
				if (type == 2) {
					return minutes;
				}
				if (type == 3) {
					return seconds;
				}

			},
			// 立即沟通
			toImRoom(item) {
				// if (this.$db.get('userInfo').membe_id == item.writer_uid) {
				// 	console.log(111111111111111)
				// 	this.$store.commit('createConversationActive', item.uid)
				// 	var url = '/pages/tim/room?userType=1&showbox=1&uid=' + item.writer_uid
				// } else {
				// 	console.log(22222222222)
				// 	this.$store.commit('createConversationActive', item.writer_uid)
				// 	var url = '/pages/tim/room?userType=1&showbox=1&uid=' + item.uid
				// }

				// uni.navigateTo({
				// 	url: url
				// })
				
				let userProfile = {}
				if (this.$db.get('userInfo').membe_id == item.writer_uid) {
					userProfile = item.user
				}else{
					userProfile = item.writer
				}
				
				if(!this.isClick){
					
					return
				}
				
				this.isClick = false
				uni.request({
				    url: 'https://api.dreamyuewen.com/api/user/userInfo', 
				    data: {
				       uid: userProfile.membe_id,
				    },
				    header: {
				        token: db.get('auth')
				    },
				    success: (res) => {
				        uni.setStorageSync("userItem",res.data.user);
						
						uni.request({
						    url: 'https://api.dreamyuewen.com/api/user/userPageList', 
						    data: {
						       uid: userProfile.membe_id,
							   page: 1,
							   type: 1
						    },
						    header: {
						        token: db.get('auth')
						    },
						    success: (ress) => {
						        uni.setStorageSync("userPageList",ress.data.data.data);
								
								uni.request({
								    url: 'https://api.dreamyuewen.com/api/order/getTimOrderList', 
								    data: {
								       uid: userProfile.membe_id,
								    },
								    header: {
								        token: db.get('auth')
								    },
								    success: (resss) => {
										setTimeout(()=> {
											this.isClick = true
										}, 2000);
								        uni.setStorageSync("orderList",resss.data.data);
										
										TUIConversationService.switchConversation('C2C'+userProfile.membe_id);
										uni.navigateTo({
											url: '/TUIKit/components/TUIChat/index'
										})
								    }
								});
						    }
						});
				    },
				})
				
				
				
					
					
					
					
					
				// emits("handleSwitchConversation", item.conversationID);
				
			},
			// 取消订单
			closeOrder() {
				this.showPop = false
				// console.log('close');
			},
			goToindex(item) {
				this.$api.default.request('order/closeOrder', {
					id: item.id
				}).then((res) => {
					if (res.code) {
						this.$common.successToShow(res.msg, () => {
							this.page = 1
							this.getList()
							
							this.showPop=false
						})
					} else {
						this.$common.errorToShow(res.msg)
					}
				})
			},
			lookOrder(item) {

				var url = ''
				if (this.$db.get('userInfo').membe_id == item.uid) {
					url = '/pages/user/orderdetail?id=' + item.id
				}
				if (this.$db.get('userInfo').membe_id == item.writer_uid) {
					url = '/pages/my/connect?id=' + item.id
				}

				// if(item.status == 1){
				// 	url = '/pages/my/connect'
				// }else if(item.status == 2){
				// 	url = '/pages/my/seeorder'
				// }else{
				// 	url = '/pages/user/orderdetail'
				// }
				//pages/user/orderdetail

				uni.navigateTo({
					url: url
				})
			},
			selStatus(item) {
				this.status = item.value
				this.page = 1
				this.show = false
				this.getList()
			},
			getList() {
				this.$api.default.request('order/orderList1', {
					status: this.status,
					type: this.navIndex,
					page: this.page,
					like: this.like
				}, 'POST', false).then((res) => {
					if (res.code == 1) {
						this.list = res.data
						if (res.data.current_page > 1) {
							res.data.data.forEach((item) => {
								this.rowList.push(item)
							})
						} else {
							this.rowList = res.data.data
						}
					}
					
					this.totalPage = false
				})
			},
			// 点击切换
			navTap(item) {
				this.navIndex = item.id
				this.page = 1
				this.status = ''
				this.getList()
			},
			// 编辑弹框
			open() {
				// console.log('open');
			},
			close() {
				this.show = false
			},
		}
	}
</script>

<style lang="scss">
	.fixed-top{
		position: fixed;
		/* #ifdef MP-WEIXIN */
		top: calc(var(--status-bar-height) + var(--window-top) - 25px);
		/* #endif */
		/* #ifndef MP-WEIXIN */
		top: 0;
		/* #endif */
		left: 0;
		width: 100%;
		background-color:  rgba(242, 245, 242, 1);
		z-index: 99;
	}
	
	.serbox {
		display: flex;
		align-items: center;
		background: #F8F8F8;
		border-radius: 142px;
		height: 72rpx;
		padding: 0 26.66rpx;
		width: 100%;
		box-sizing: border-box;
		
		.serpic {
			width: 32rpx;
			height: 32rpx;
			flex-shrink: 0;
		}
	
		.serput {
			padding: 0 16rpx;
			width: 500rpx;
			font-size: 28rpx;
			color: #333333;
		}
	}
	
	// 10.16新增
	.status-box {
		box-sizing: border-box;
		padding: 10px 15px;
		white-space: nowrap;
		font-family: Source Han Sans CN;
		font-size: 14px;
		color: #999999;

		text {
			margin-right: 24rpx;
		}

		.current {
			font-weight: bold;
			color: #3D3D3D;
		}
	}

	page {
		background: rgba(242, 245, 242, 1);
	}

	.content {
		/* #ifdef MP-WEIXIN */
		padding-top: calc(var(--status-bar-height) + var(--window-top) + 75px);
		/* #endif */
		/* #ifndef MP-WEIXIN */
		padding-top: 85px;
		/* #endif */
		
		.topli {
			background-color: #ffffff;
			padding: 20rpx 30rpx;
			width: 100%;
			box-sizing: border-box;
			display: flex;
			align-items: center;
			justify-content: center;

			.toptxt {
				width: 50%;
				text-align: center;
				font-size: 24rpx;
				color: #999999;
			}

			.active {
				font-weight: bold;
				color: #3d3d3d;
			}
		}

		.orbox {
			padding: 20rpx 30rpx;

			.ortop {
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-bottom: 20rpx;

				.ortitle {
					font-size: 32rpx;
					font-weight: bold;
					letter-spacing: 0em;
					color: #3D3D3D;
				}

				.oryou {
					display: flex;
					align-items: center;
					justify-content: flex-end;

					.orpic {
						width: 32rpx;
						height: 32rpx;
					}

					.saitxt {
						padding-left: 32rpx;
						font-size: 24rpx;
						font-weight: normal;
						text-align: right;
						letter-spacing: 0em;
						color: #999999;
					}
				}
			}

			.orli {
				padding: 20rpx 20rpx 16rpx;
				border-radius: 8px;
				opacity: 1;
				background: #FFFFFF;
				margin-bottom: 15rpx;

				.shbox {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding-bottom: 20rpx;

					.head {
						width: 40rpx;
						height: 40rpx;
						border-radius: 50%;
						flex-shrink: 0;
					}

					.shou {
						flex-grow: 1;
						padding: 0 12rpx;
						font-size: 24rpx;
						font-weight: normal;
						letter-spacing: 0em;
						color: #3D3D3D;
					}

					.taitxt {
						font-size: 20rpx;
						font-weight: bold;
						letter-spacing: 0em;
						color: #3D3D3D;
						flex-shrink: 0;
					}

					.tuitxt {
						font-size: 20rpx;
						color: #999999;
						font-weight: bold;

						.status1 {
							color: #ED3232;
						}

						.status2 {
							color: #3D3D3D;
						}

						.status3 {
							color: #45C4B0;
						}
					}

					.lv {
						color: #45C4B0;
						font-weight: bold;
					}
				}

				.jjbox {
					display: flex;
					align-items: center;

					.kpic {
						width: 32rpx;
						height: 32rpx;
					}

					.jtxt {
						font-size: 28rpx;
						font-weight: bold;
						letter-spacing: 0em;
						color: #3D3D3D;
						padding-left: 12rpx;
					}
				}

				.dbox {
					display: flex;
					align-items: flex-end;
					justify-content: space-between;

					.dtxt {
						font-size: 20rpx;
						color: #3D3D3D;

						text {
							padding-left: 8rpx;
							font-size: 20rpx;
							color: #999999;
						}
					}

					.gong {
						font-size: 20rpx;
						color: #999999;

						text {
							font-size: 36rpx;
							color: #3D3D3D;
							padding: 0 8rpx;
							font-weight: bold;
						}

						.active {
							color: #3D3D3D;
						}

						.lv {
							color: #45C4B0;
						}
					}
				}
			}
		}

		.mask {
			background: #F2F5F2;
			border-top-left-radius: 8px;
			border-top-right-radius: 8px;
			overflow: hidden;

			.mabox {
				margin-bottom: 20rpx;

				.matop {
					display: flex;
					align-items: center;
					justify-content: space-between;
					padding: 40rpx 50rpx;
					border-bottom: 1px solid rgba(153, 153, 153, 0.1);
					background-color: #ffffff;

					.mapic {
						width: 40rpx;
						height: 40rpx;
						flex-shrink: 0;
					}

					.matxt {
						flex-grow: 1;
						font-size: 28rpx;
						padding: 0 16rpx;
						font-weight: bold;
						letter-spacing: 0em;
						color: #3D3D3D;
					}
				}
			}

			.qubox {
				line-height: 120rpx;
				text-align: center;
				font-size: 28rpx;
				font-weight: bold;
				letter-spacing: 0em;
				color: #3D3D3D;
				height: 120rpx;
				opacity: 1;
				background: #FFFFFF;
			}
		}
	}

	.order-tip {
		padding: 16rpx 25rpx;
		border-radius: 4px;
		margin: 20rpx 0;

		image {
			width: 24rpx;
			height: 24rpx;
		}

		.status-txt {
			font-family: Source Han Sans CN;
			font-size: 10px;
			font-weight: bold;
			margin: 0 8rpx;
		}

		.order-tip-right,
		.status-desc {
			font-family: Source Han Sans CN;
			font-size: 10px;
		}
	}

	// 待接单 进行中
	.order-tip1 {
		background: rgba(69, 196, 176, 0.15);

		.status-txt {
			color: #45C4B0;
		}

		.order-tip-right,
		.status-desc {
			color: #45C4B0;
		}
	}

	// 待处理 已退款
	.order-tip2 {
		background: #F2F5F2;

		.status-txt {
			color: #3D3D3D;
		}

		.order-tip-right,
		.status-desc {
			color: #3D3D3D;
		}
	}

	.buttons {
		justify-content: flex-end;

		.button-item {
			width: 62px;
			height: 20px;
			border-radius: 94px;
			padding: 3px 10px;
			font-family: Source Han Sans CN;
			font-size: 10px;
			margin-left: 16rpx;
			display: flex;
			align-items: center;
			justify-content: center;
		}

		.button1 {
			background: #F2F5F2;
			color: #999999;
		}

		.button2 {
			background: rgba(69, 196, 176, 0.15);
			color: #45C4B0;
		}
	}

	.mask {
		background-color: #ffffff;
		width: 534rpx;
		border-radius: 8px;
		padding-top: 48rpx;

		.matitle {
			font-size: 32rpx;
			font-weight: bold;
			text-align: center;
			letter-spacing: 0em;
			color: #3D3D3D;
			padding-bottom: 6rpx;
			line-height: 46rpx;
		}

		.matxt {
			font-size: 24rpx;
			font-weight: normal;
			text-align: center;
			letter-spacing: 0em;
			color: #999999;
			line-height: 34rpx;
			padding-bottom: 50rpx;
		}

		.quque {
			display: flex;
			align-items: center;
			border-top: 1px solid rgba(153, 153, 153, 0.1);

			.quli {
				width: 50%;
				height: 80rpx;
				line-height: 80rpx;
				text-align: center;
				font-size: 32rpx;
				font-weight: normal;
				letter-spacing: 0em;
				color: #3D3D3D;
			}

			.quactive {
				background: rgba(69, 196, 176, 0.05);
			}
		}
	}
	
	/deep/.scoped-ref view{
		display: flex;
		align-items: center;
		white-space: nowrap;
	}
	
	.time_model{
		display: flex;
		align-items: center;
		font-weight: bold;
	}
</style>